

void Goto_XY (short x, short y )
{
	COORD coord = {x, y};
	SetConsoleCursorPosition ( GetStdHandle ( STD_OUTPUT_HANDLE ), coord );
}

template <typename T>
void Goto_XY (T var)
{
	
	COORD coord = {var.x, var.y};
	SetConsoleCursorPosition ( GetStdHandle ( STD_OUTPUT_HANDLE ), coord );
}


void HideCursor()
{
	HANDLE out = GetStdHandle (STD_OUTPUT_HANDLE);

	CONSOLE_CURSOR_INFO     cursorInfo;

	GetConsoleCursorInfo (out, &cursorInfo);
	cursorInfo.bVisible = false; // set the cursor visibility
	SetConsoleCursorInfo (out, &cursorInfo);
}

void Draw_Edge (short x, short y, size_t width, size_t height)
{
	enum name_sym {LUC=0, LDC, RDC, RUC, VL, HL, SPS};
	const unsigned char edge_sym[] = {201,200,188,187,186,205,250};

	Goto_XY (x, y);
	for (size_t i= 0; i< width; ++i)
	{
		if (i==0) { cout << edge_sym[LUC]; continue;}
		if (i==(width-1)) { cout << edge_sym[RUC]; continue;}
		cout << edge_sym[HL];
	}
	Goto_XY (x, y+height-1);
	for (size_t i= 0; i< width; ++i)
	{
		if (i==0) { cout << edge_sym[LDC]; continue;}
		if (i==(width-1)) { cout << edge_sym[RDC]; continue;}
		cout << edge_sym[HL];
	}
	for (size_t i= 1; i< height-1; ++i)
	{
		Goto_XY (x, y+i);
		cout << edge_sym[VL];
		Goto_XY (x+width-1, y+i);
		cout << edge_sym[VL];
	}
	
}

template <typename T>
void Draw_Edge (T var, bool line=0)
{
	short x = var.x;
	short y = var.y;
	short width = var.w;
	short height = var.h;
	//short set_color = var.color
	
	enum name_sym {LUC=0, LDC, RDC, RUC, VL, HL, SPS};
	const unsigned char edge_sym[2][7] = {	218,192,217,191,179,196,0,
											201,200,188,187,186,205,250};
	
	Goto_XY (x, y);
	//SetConsoleTextAttribute (GetStdHandle ( STD_OUTPUT_HANDLE ), set_color);
	for (size_t i= 0; i< width; ++i)
	{
		if (i==0) { cout << edge_sym[line][LUC]; continue;}
		if (i==(width-1)) { cout << edge_sym[line][RUC]; continue;}
		cout << edge_sym[line][HL];
	}
	Goto_XY (x, y+height-1);
	for (size_t i= 0; i< width; ++i)
	{
		if (i==0) { cout << edge_sym[line][LDC]; continue;}
		if (i==(width-1)) { cout << edge_sym[line][RDC]; continue;}
		cout << edge_sym[line][HL];
	}
	for (size_t i= 1; i< height-1; ++i)
	{
		Goto_XY (x, y+i);
		cout << edge_sym[line][VL];
		Goto_XY (x+width-1, y+i);
		cout << edge_sym[line][VL];
	}
	
}

